package com.laiyizhan.common.mapper;

import com.laiyizhan.common.model.Fourth_b;
import com.laiyizhan.common.model.Third_b;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface Fourth_bMapper {
    @Select({
            "select",
            "*",
            "from Fourth_b",
            "where hospital = #{oName,jdbcType=VARCHAR}"
    })
    @ResultMap("BaseResultMap")
    List<Fourth_b> selectByName(String oName);
    @Delete({
            "delete from Fourth_b",
            "where hospital = #{oName,jdbcType=VARCHAR}"
    })
    int deleteByName(String oName);
    @Delete({
        "delete from fourth_b",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int deleteByPrimaryKey(Long id);

    @Insert({
        "insert into fourth_b (hospital, age, ",
        "sex, diagnosis, ",
        "count_one, count_two, ",
        "count_three)",
        "values (#{hospital,jdbcType=VARCHAR}, #{age,jdbcType=VARCHAR}, ",
        "#{sex,jdbcType=VARCHAR}, #{diagnosis,jdbcType=VARCHAR}, ",
        "#{countOne,jdbcType=VARCHAR}, #{countTwo,jdbcType=VARCHAR}, ",
        "#{countThree,jdbcType=VARCHAR})"
    })
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="id", before=false, resultType=Long.class)
    int insert(Fourth_b record);

    int insertSelective(Fourth_b record);

    @Select({
        "select",
        "id, hospital, age, sex, diagnosis, count_one, count_two, count_three",
        "from fourth_b",
        "where id = #{id,jdbcType=BIGINT}"
    })
    @ResultMap("BaseResultMap")
    Fourth_b selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(Fourth_b record);

    @Update({
        "update fourth_b",
        "set hospital = #{hospital,jdbcType=VARCHAR},",
          "age = #{age,jdbcType=VARCHAR},",
          "sex = #{sex,jdbcType=VARCHAR},",
          "diagnosis = #{diagnosis,jdbcType=VARCHAR},",
          "count_one = #{countOne,jdbcType=VARCHAR},",
          "count_two = #{countTwo,jdbcType=VARCHAR},",
          "count_three = #{countThree,jdbcType=VARCHAR}",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(Fourth_b record);



    int insertBatch(List<Fourth_b> item);
}